package com.jwthhealth_pub.old.report.util.request.requtil;

import java.security.MessageDigest;

class MD5Util {
   static String getMD5(String str) {
//        str = str.toLowerCase();
       MessageDigest messageDigest ;
       try {
           messageDigest = MessageDigest.getInstance("MD5");
           messageDigest.reset();
           messageDigest.update(str.getBytes("UTF-8"));
           byte[] byteArray = messageDigest.digest();
           StringBuilder buf = new StringBuilder();
//            int len = byteArray.length;
           for (byte aByteArray : byteArray) {
               if (Integer.toHexString(0xFF & aByteArray).length() == 1) {
                   buf.append(0).append(Integer.toHexString(0xff & aByteArray));
               } else {
                   buf.append(Integer.toHexString(0xff & aByteArray));
               }
           }

           return buf.toString();
       } catch (Exception e) {
           e.printStackTrace();
       }
       return null;
   }
}
